* Apply to:  sfbos_1_scores.csv
* Description:  Plot ideal points from roll call analysis

clear
set more off


import delimited "...\1805 Roadmaps\Figures A5 and A6\sfbos_1_scores.csv", delimiter(comma)


* Fix variable names

rename v1 name
rename v2 faction


* Define rank

sort coord1d

gen rank = _n


twoway scatter rank coord1d if faction=="Moderate", ///
     mcolor(navy) msymbol(s) msize(large) || ///
     scatter rank coord1d if faction=="Progressive", ///
	 mcolor(maroon) msymbol(t) msize(large) || ///
	 scatter rank coord1d if faction=="None", ///
	 mcolor(black) msymbol(O) msize(large) ///
     xlabel(-1(.5)1) xmlabel(-1.2(.5)1.2, notick nolabel) ///
	 xtitle(" " "{bf:Progressive-Moderate Dimension}") ///
	 ylabel(1(1)11) ymlabel(0(1)11.5, nolabel) ///
	 ytitle("{bf:Rank}" " ") ///
     xline(.63, lcolor(gs10)) ///
	 text(2 .97 "{bf:Oppose Setting}" "{bf:Nutritional}" "{bf:Standards}", color(gs10) size(medsmall)) ///
	 text(9 -.65 "{bf:Favor Setting}" "{bf:Nutritional}" "{bf:Standards}", color(gs10) size(medsmall)) ///
 	 text(1 -.95 "{bf:Daly}", color(maroon) size(medsmall) placement(e)) ///
 	 text(2 -.37 "{bf:Mirkarimi}", color(maroon) size(medsmall) placement(w)) ///
 	 text(3 -.27 "{bf:Campos}", color(maroon) size(medsmall) placement(e)) ///
 	 text(4 -.36 "{bf:Avalos}", color(maroon) size(medsmall) placement(w)) ///
 	 text(5 -.25 "{bf:Mar}", color(maroon) size(medsmall) placement(w)) ///
 	 text(6 .08 "{bf:Chiu}", color(maroon) size(medsmall) placement(e)) ///
 	 text(7 .18 "{bf:Maxwell}", color(maroon) size(medsmall) placement(w)) ///
 	 text(8 .41 "{bf:Dufty}", color(navy) size(medsmall) placement(w)) ///
 	 text(9 .83 "{bf:Chu}", color(navy) size(medsmall) placement(e)) ///
 	 text(10 .82 "{bf:Alioto-Pier}", color(navy) size(medsmall) placement(w)) ///
 	 text(11 .95 "{bf:Elsbernd}", color(navy) size(medsmall) placement(w)) ///
	 legend(off) plotregion(margin(zero) color(white)) graphregion(color(white))


twoway scatter rank coord1d if faction=="Moderate", ///
     mcolor(navy) msymbol(s) msize(large) || ///
     scatter rank coord1d if faction=="Progressive", ///
	 mcolor(maroon) msymbol(t) msize(large) || ///
	 scatter rank coord1d if faction=="None", ///
	 mcolor(black) msymbol(O) msize(large) ///
     xlabel(-1(.5)1) xmlabel(-1.2(.5)1.2, notick nolabel) ///
	 xtitle(" " "{bf:Progressive-Moderate Dimension}") ///
	 ylabel(1(1)11) ymlabel(0(1)11.5, nolabel) ///
	 ytitle("{bf:Rank}" " ") ///
     xline(.80, lcolor(gs10)) ///
	 text(2 1.05 "{bf:Oppose}" "{bf:Non-Citizen}" "{bf:Voting for}" "{bf:School}" "{bf:Board}", color(gs10) size(medsmall)) ///
	 text(9 -.65 "{bf:Favor}" "{bf:Non-Citizen}" "{bf:Voting for}" "{bf:School}" "{bf:Board}", color(gs10) size(medsmall)) ///
 	 text(1 -.95 "{bf:Daly}", color(maroon) size(medsmall) placement(e)) ///
 	 text(2 -.37 "{bf:Mirkarimi}", color(maroon) size(medsmall) placement(w)) ///
 	 text(3 -.27 "{bf:Campos}", color(maroon) size(medsmall) placement(e)) ///
 	 text(4 -.36 "{bf:Avalos}", color(maroon) size(medsmall) placement(w)) ///
 	 text(5 -.25 "{bf:Mar}", color(maroon) size(medsmall) placement(w)) ///
 	 text(6 .08 "{bf:Chiu}", color(maroon) size(medsmall) placement(e)) ///
 	 text(7 .18 "{bf:Maxwell}", color(maroon) size(medsmall) placement(w)) ///
 	 text(8 .41 "{bf:Dufty}", color(navy) size(medsmall) placement(w)) ///
 	 text(9 .83 "{bf:Chu}", color(navy) size(medsmall) placement(e)) ///
 	 text(10 .82 "{bf:Alioto-Pier}", color(navy) size(medsmall) placement(w)) ///
 	 text(11 .95 "{bf:Elsbernd}", color(navy) size(medsmall) placement(w)) ///
	 legend(off) plotregion(margin(zero) color(white)) graphregion(color(white))

* End
